<div class="page-content">
    <div class="panel panel-default">
        <div class="panel-heading">
            <ul class="breadcrumb">
                <li><a href="<{:U('dict')}>">字典管理</a> </li>
                <li class="active">添加/修改字典</li>
            </ul>
        </div>
        <div class="panel-body">
            <form enctype="multipart/form-data" class="form-horizontal" method="post" action="/BoxAdmin/System/dict_add">
                <div class="form-group" <if condition="$data['name'] && $showName eq 0">style="display:none"</if>>
                    <label for="input-title" class="col-sm-2 control-label">字典名称</label>
                    <div class="col-sm-7">
                        <input type="text" class="form-control" id="name" name="name" value="<{$data['name']}>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="input-title" class="col-sm-2 control-label">备注</label>
                    <div class="col-sm-7">
                        <input type="text" class="form-control" id="remark" name="remark" value="<{$data['remark']}>">
                    </div>
                </div>
                <div class="form-group">
                    <label for="input-title" class="col-sm-2 control-label">数据</label>
                    <div class="col-sm-7">
                        <if condition="$type eq 'string'">
                            <input type="button" value="文本域" onclick="unIntEdit()" class="btn btn-default btn-sm" />
                            <input type="button" value="编辑器" onclick="intEdit()" class="btn btn-primary btn-sm" />
                        </if>
                        <textarea style="height:200px" name="value" class="form-control" id="value"><{$data[ 'value']}></textarea>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-7">
                        <button type="submit" class="btn btn-primary">保存</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
function unIntEdit() {
    $(".ke-container").hide();
    $("[name='value']").show();
}


function intEdit() {
    hiApp.kindeditor($("[name='value']"));
    $(".ke-container").show();
    $("[name='value']").hide();
}

$(function() {
    $(".form-horizontal").bootstrapValidator({
        message: '您填入的值不合法',
        fields: {

            name: {
                message: '字典名称',
                validators: {
                    notEmpty: {
                        message: '字典名称不能为空'
                    },
                }
            },

            value: {
                message: '数据',
                validators: {
                    notEmpty: {
                        message: '数据不能为空'
                    },
                }
            },

            remark: {
                message: '备注',
                validators: {
                    notEmpty: {
                        message: '备注不能为空'
                    },
                }
            },



        }
    });


});
</script>
